package com.nuaa.ange.mybatis_plus;

import com.nuaa.ange.mapper.UserMapper;
import com.nuaa.ange.entity.User;
import com.nuaa.ange.service.UserService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 玦离
 * @description test
 * @date 2022/12/28 22:19
 */

@SpringBootTest
public class test {

    //继承了BaseMapper ,所有方法来自父类，可扩展
    @Resource
    private UserService userService;

    @Test
    public void contextLoads() {
        System.out.println(("----- selectAll method test 测试查询所有用户方法 ------"));
        //selectList 的参数wrapper 是条件构造器，可以先写null
        User user = userService.getById(1);
        //forEach 的参数是 Consumer类型的 语法糖
        System.out.println(user);
    }
}
